package servlet;

import util.JdbcUtil;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.PreparedStatement;


public class OutboundreDeleteServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int outid = Integer.parseInt(request.getParameter("outid"));
        String sql ="DELETE FROM record_out WHERE outid=?";
        try {
            PreparedStatement ps	= JdbcUtil.getConnection().prepareStatement(sql);
            ps.setInt(1, outid);
            ps.executeUpdate();
            request.getRequestDispatcher("outbound.jsp").forward(request, response);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
